package com.lixingqu.mvpdemo.ui.login;

/**
 * Created by lixingqu on 2016/11/28.
 */

public class LoginModelImpl implements ILoginModel {

    @Override
    public void login(final String name, final String password, final Callback callback) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                if ("lxq".equals(name)&&"123".equals(password)){
                    User user = new User("lxq","123");
                    callback.loginSuccess(user);
                }else {
                    callback.loginError();
                }
            }
        }).start();
    }

    public interface Callback{
        void loginSuccess(User user);
        void loginError();
    }
}
